{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "28167ea8-efc9-4fef-abb5-94da1453f462",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "随机生成的二维整数数组arr1:\n",
      " [[8 6 3]\n",
      " [4 8 8]\n",
      " [3 2 1]]\n",
      "随机生成的一维整数数组arr2:\n",
      " [6 2 2]\n",
      "随机生成的二维小数数组arr3:\n",
      " [[7.4563408  7.91696268 6.71112776]\n",
      " [5.1760488  3.41020937 7.17939497]\n",
      " [7.60988651 1.37496144 6.29610698]]\n",
      "arr1和arr2相加:\n",
      " [[14  8  5]\n",
      " [10 10 10]\n",
      " [ 9  4  3]]\n",
      "arr1和arr3相乘:\n",
      " [[59.65072643 47.50177606 20.13338329]\n",
      " [20.70419519 27.28167495 57.43515975]\n",
      " [22.82965953  2.74992288  6.29610698]]\n",
      "以arr1为底数,arr2为指数的幂:\n",
      " [[262144     36      9]\n",
      " [  4096     64     64]\n",
      " [   729      4      1]]\n",
      "arr1的倒数:\n",
      " [[0.125      0.16666667 0.33333333]\n",
      " [0.25       0.125      0.125     ]\n",
      " [0.33333333 0.5        1.        ]]\n",
      "arr3四舍五入,小数点后保留一位:\n",
      " [[7.5 7.9 6.7]\n",
      " [5.2 3.4 7.2]\n",
      " [7.6 1.4 6.3]]\n",
      "arr1的余弦值:\n",
      " [[0.99026807 0.9945219  0.99862953]\n",
      " [0.99756405 0.99026807 0.99026807]\n",
      " [0.99862953 0.99939083 0.9998477 ]]\n"
     ]
    }
   ],
   "source": [
    "import numpy as np\n",
    "arr1=np.random.randint(1,10,size=(3,3))\n",
    "print('随机生成的二维整数数组arr1:\\n',arr1)\n",
    "arr2=np.random.randint(1,10,size=3)\n",
    "print('随机生成的一维整数数组arr2:\\n',arr2)\n",
    "arr3=np.random.rand(3,3)*10\n",
    "print('随机生成的二维小数数组arr3:\\n',arr3)\n",
    "print('arr1和arr2相加:\\n',np.add(arr1,arr2))\n",
    "print('arr1和arr3相乘:\\n',np.multiply(arr1,arr3))\n",
    "print('以arr1为底数,arr2为指数的幂:\\n',np.power(arr1,arr2,dtype='int64'))\n",
    "print('arr1的倒数:\\n',np.reciprocal(arr1,dtype='float'))\n",
    "print('arr3四舍五入,小数点后保留一位:\\n',np.around(arr3,decimals=1))\n",
    "print('arr1的余弦值:\\n',np.cos(arr1*np.pi/180))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "4cb6d34f-a433-499d-8b0c-7702a10f806d",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.13.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
